Skip to content

[Confluence] Server attach_content: always POST to update an attachment - #1687

Merged
gonchik merged 1 commit into
atlassian-api:masterfrom
RizgarOzan:fix/server-attach-content-post
Oct 3, 2026
Merged

gonchik merged 1 commit into
atlassian-api:masterfrom
RizgarOzan:fix/server-attach-content-post

Conversation

@RizgarOzan

@RizgarOzan RizgarOzan commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #1681

#1679 put the POST-to-/data path back for updating an existing attachment, but only when api_version == "1.0". ConfluenceServer now defaults to api_version="latest", so with default settings an update still went to the PUT branch, which Server/Data Center doesn't support.

The Server class now always updates an existing attachment with POST rest/api/content/{page_id}/child/attachment/{attachment_id}/data and the PUT branch is gone. Creating a new attachment is unchanged. I went with the option suggested in the issue, since this method lives only on the Server class; the Cloud client is a separate class and never goes through it.

How I tested:

  • New test test_attach_content_updates_existing_attachment_with_post, parametrized over the default, "latest" and "1.0". On master the default and "latest" cases fail (PUT is called); with the change all three pass.
  • pytest: 1723 passed, 10 skipped.
  • flake8 and black 25.1.0 clean, bandit reports nothing for confluence/server. mypy shows the same 12 existing errors as master, none in this file.

The update branch only used POST when api_version was "1.0", but Server now defaults to "latest", so updating an existing attachment went to the PUT path that Server doesn't support.

Fixes atlassian-api#1681
@codecov

codecov Bot commented Oct 3, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 65.21%. Comparing base (f49cef5) to head (ed50f06).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1687      +/-   ##
==========================================
+ Coverage   65.16%   65.21%   +0.04%     
==========================================
  Files         106      106              
  Lines       19210    19207       -3     
  Branches     2086     2085       -1     
==========================================
+ Hits        12518    12525       +7     
+ Misses       6004     5995       -9     
+ Partials      688      687       -1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@gonchik
gonchik merged commit 2a33d06 into atlassian-api:master Oct 3, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

server#attach_content still does not work correctly

2 participants